package com.qianli.user.facade.query.impl.info;

import com.fqgj.common.api.Response;
import com.qianli.user.application.UserInfoApplication;
import com.qianli.user.facade.query.info.UserInfoServiceFacade;
import com.qianli.user.ro.UserStateCode;
import com.qianli.user.ro.info.UserInfoRO;
import com.qianli.user.ro.query.UserInfoQueryRO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * name:用户资料
 * auth:ting.li@qianli-inc.com
 * date:2018/1/3 20:53
 * version: v1.0.0
 **/
@Service("userInfoServiceFacade")
public class UserInfoServiceFacadeImpl implements UserInfoServiceFacade{

    private static final Logger LOGGER = LoggerFactory.getLogger(UserInfoServiceFacade.class);

    @Autowired
    private UserInfoApplication userInfoApplication;
    /**
     * 获取用户资料
     * @param queryRO
     * @return
     */
    @Override
    public Response<UserInfoRO> getUserInfo(UserInfoQueryRO queryRO) {
        if(null == queryRO){
            LOGGER.info("UserInfoServiceFacade.getUserInfo param can not be null");
            return Response.error(UserStateCode.PARAMETER_LACK,"参数不能为空");
        }
        if(null == queryRO.getUserCode()){
            LOGGER.info("UserInfoServiceFacade.getUserInfo param userCode can not be null");
            return Response.error(UserStateCode.PARAMETER_LACK,"参数userCode不能为空");
        }
        Response<UserInfoRO> response = userInfoApplication.getUserInfo(queryRO);
        return response;
    }
}
